﻿using System;
using WebStickyNotes.Contracts.Interfaces;

namespace WebStickyNotes.Data.Access
{
    public class Supplier : IDisposable
    {
        public IWebStickyNotesDataAccess DataAccess;

        public Supplier(string type, string connectionString)
        {
            switch (type)
            {
                case "Access":
                    DataAccess = new AccessDataAccess(connectionString);
                    break;
				case "MySql":
					DataAccess = new MySqlDataAccess(connectionString);
					break;
                default:
                    throw new ArgumentException(string.Format("Type {0} not recognised.", type));
            }
        }

        public void Dispose()
        {
            DataAccess.Dispose();
        }
    }
}
